﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DAL;
using DTO;


namespace BLL
{
   public class NguoiDung_BLL
    {
       public static int dangnhap(NguoiDung_DTO nguoidung)
       {
           try
           {
               DataTable dt = NguoiDung_DAL.LoadNguoiDung();
               string tendangnhap = dt.Rows[0]["TENDANGNHAP"].ToString();
               string matkhau = dt.Rows[0]["MATKHAU"].ToString();
               int maloai = Convert.ToInt32(dt.Rows[0]["MALOAI"]);
               if (nguoidung.STENDANGNHAP == tendangnhap && nguoidung.SMATKHAU == matkhau)
               {
                   if (maloai == 1)
                   {
                       return 1;
                   }
                   return 2;
               }
               return 3;
           }
           catch (Exception ex)
           {
               return 3;
           }
       }

    }
}
